﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StudentLib
{
    public class Student
    //class should represent something. Class student is a template that I can use to build each of the students. 
    //From a structural standpoint, everybody has a first name and a last name. 
    //Everybody has a visitor pass. So those are three things that everybody has. 
    //The values may be different but we all have the fields. 
    {

        //fields 
        private static int counter = 0; 
        int id = 0;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }


        string firstName = ""; //private by default; 

        public int Counter
        {
            get { return StudentLib.Student.counter; }
            set { StudentLib.Student.counter = value; }
        }
        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; }
        }


        string lastName = "";

        public string LastName
        {
            get { return lastName; }
            set { lastName = value; }
        }
        string streetAddress = "";

        public string StreetAddress
        {
            get { return streetAddress; }
            set { streetAddress = value; }
        }
        string city = "";

        public string City
        {
            get { return city; }
            set { city = value; }
        }
        string state = "";

        public string State
        {
            get { return state; }
            set { state = value; }
        }
        string zip = "";

        public string Zip
        {
            get { return zip; }
            set { zip = value; }
        }

        //methods 
        bool isforWeb = false;
        public Student(bool isforWeb)
        {
            this.isforWeb = isforWeb;
            //this is like our reference, a pointer pointing back to our object 
            Student.counter += 1;
            this.id = Student.counter;

        }

        //create a private method to access the spaces 
        protected string GetSpace()
        {
            string space = "";
            if (isforWeb)
            {
                space = "&nbsp;";
            }
            else
            {
                space = " ";
            }

            return space;

        }

        protected string GetLineBreak()
        {
            string lineBreak = "";
            if (isforWeb)
            {
                lineBreak = "<br/>";
            }
            else
            {
                lineBreak = "\r\n";
            }

            return lineBreak;
        }

        public virtual string MailingLabel()
        //inside any class we have access specifiers. private, public, or protected 
        //The code that can access anything in private must be inside it 
        //For public, it can be anywhere. 
        //For protected, we are public inside a sub class but private everywhere else 
        {
            string label = firstName + GetSpace() + lastName + GetLineBreak();
            label += streetAddress + GetLineBreak();
            label += city + GetSpace() + state + GetSpace() + zip + GetLineBreak();
            label += GetLineBreak() + "ID:" + GetSpace() + Id;

            return label;
        }

    }
}
